package kr.co.redcircle.broker.information;

import kr.co.redcircle.broker.Broker;
import net.sf.json.JSONObject;

public class HostInfo {
	
	private String cid = null;
	private String ip = null;
	private int port = -1;
	public String getIp() {
		return ip;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public int getPort() {
		return port;
	}
	public void setPort(int port) {
		this.port = port;
	}
	public String getCid() {
		return cid;
	}
	public void setCid(String cid) {
		this.cid = cid;
	}
	
	public HostInfo(String ip, int port) {
		super();
		this.ip = ip;
		this.port = port;
	}
		
	public HostInfo(JSONObject resultJSONObject) {
		if (resultJSONObject != null){
			cid = resultJSONObject.getString(Broker.CID_S);
			ip = resultJSONObject.getString(Broker.IP);
			port = resultJSONObject.getInt(Broker.PORT);
		}
	}
	@Override
	public String toString() {
		return "HostInfo [cid=" + cid + ", ip=" + ip + ", port=" + port + "]";
	}

	
}
